package com.bsoft.rpc.basic.transport;

import com.alibaba.fastjson.JSON;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.SimpleChannelInboundHandler;
import lombok.extern.slf4j.Slf4j;

/**
 * 客户端消息处理类
 */
@Slf4j
public class NettyClientHandler extends SimpleChannelInboundHandler<Message> {

    @Override
    protected void channelRead0(ChannelHandlerContext ctx, Message massage) throws Exception {
        // 打印接收到服务端消息
        log.info("========> get response from server[{}], msg: {}", ctx.channel().remoteAddress().toString().substring(1), JSON.toJSONString(massage));
    }

}
